Software programs typically include numerous “memory allocation” functions. A memory allocation function, such as the C “malloc” function, sets aside a portion of the computer's memory resources (i.e., a “memory object”) for use by the associated software program.
Software compilers often attempt to disambiguate references to memory objects during compile time in order to produce more efficient object code. For pointers to static memory objects, the compile-time names of the memory objects may be used to abstract the target memory. However, dynamically allocated memory objects do not have compile-time names. Instead, the compiler may use the static allocation site of the memory object as a compile-tie name.
However, using this scheme, the compiler cannot disambiguate between objects associated with the same allocation site if a call is made to a standard memory allocation function within a user defined function (i.e., the compiler cannot tell the difference between two different memory objects produced by two different calls to the same user-defined function which allocates memory). As a result, memory objects produced by memory allocation functions which are included in a user-defined function are not distinguished during compile-time when more than one call to the user-defined function is made by the software. In other words, the compiler does not recognize the user-defined function as a memory allocation function, because the compiler does not know if the user-defined function returns a new memory object every time the user-defined function is invoked, and the compiler does not know if variables being assigned are available outside the scope of the user defined function (i.e., the address of the allocated memory object may or may not be stored in a variable or a data structure that is accessible by a function that is not within the user-defined function.)